#!/bin/sh

# $Id: jatte.sh 7 2013-09-13 03:26:03Z alan.watson.f@gmail.com $

# Copyright 2013 Alan M. Watson.

if test -r "$HOME/.jatte"
then
  . "$HOME/.jatte"
fi
if test -r "./.jatte"
then
  . "./.jatte"
fi

export JATTE_PREFIX="${JATTE_PREFIX:-@PREFIX@}"
export JATTE_THREADS="${JATTE_THREADS:-4}"
export JATTE_LIBEXECDIR="${JATTE_LIBEXECDIR:-${JATTE_PREFIX}/libexec/jatte/}"

usage () {
cat <<EOF
Usage: 

  jatte <subcommand> [argument ...]

Subcommands:

  help
  import

EOF
}

if test $# == 0
then
  usage
  exit 0
fi

subcommand="$1"
shift

case "$subcommand" in
help)
  usage
  exit 0
  ;;
import)
  exec "$JATTE_LIBEXECDIR"/import "$@"
  ;;
*)
  echo 1>&2 "error: unrecognized subcommand \"$subcommand\"."
  exit 1
  ;;
esac

